<template>
	<!-- 基本信息折叠面板 -->
	<view class="collapse">
		<view class="collapse_title" @click="isOpen = !isOpen">
			<view class="collapse_name">{{ name }}</view>
			<image src="../../../static/synergy/arrow.png" mode="" :style="{transform: isOpen?'rotate(0deg)':'rotate(180deg)'}"></image>
		</view>
		<view :style="{ height: isOpen?'2rpx':'0' }" class="line"></view>
		<view class="collapse_content" id="collapse_main" :style="{ height: isOpen?maxHeight + 'px':0 }">
			<slot></slot>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				isOpen: true,
			}
		},
		props: {
			name: {
				type: String
			},
			maxHeight: {
				type: [Number,String],
				require: true
			},
		},
		methods: {}
	}
</script>
<style lang="scss" scoped>
.collapse{
	width: 100%;
	background: #FFFFFF;
	box-shadow: 0px 2px 10px 0px rgba(0,0,0,0.1000);
	border-radius: 10px;
	margin-bottom: 20rpx;
	.collapse_title{
		padding: 20rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		.collapse_name{
			font-size: 14px;
			// font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #171717;
			line-height: 20px;
		}
		image{
			width: 16px;
			height: 16px;
			transition: transform .3s,-webkit-transform .3s;
		}
	}
	.line{
		width: 100%;
		background: rgba(0,0,0,0.1);
		transition: height .3s;
	}
	.collapse_content{
		transition: height .4s ease-in-out, -webkit-transform .4s ease-in-out, transform .4s ease-in-out;
		transform-origin: 50% 50% 0px;
		overflow: hidden;
	}
}
</style>